<?php

namespace Apps\Common\Models;

/**
 * 运营中的banner位Model
 * @author     chenxiaolin
 * @date        2016年1月19日
 * @version     2.0.0
 * @copyright   Copyright 2016 meelier.com
 */
class OmBanner extends \PhalconPlus\Database\Model
{
    /**
     *
     * @var integer
     */
    public $banner_id;

    /**
     *
     * @var integer
     */
    public $city_id;

    /**
     *
     * @var integer
     */
    public $banner_name;

    /**
     *
     * @var string
     */
    public $banner_data;

    /**
     *
     * @var string
     */
    public $banner_update_time;
    
    /*
     * 新增字段：排序
     */
    public $sort;
    
    public $banner_addtime;
    public $state;

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'om_banner';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return OmBanner[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return OmBanner
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'banner_id' => 'banner_id',
            'city_id' => 'city_id',
            'banner_name' => 'banner_name',
            'banner_data' => 'banner_data',
            'banner_update_time' => 'banner_update_time',
        	'sort' => 'sort',
            'banner_addtime' => 'banner_addtime',
            'state' => 'state'
        );
    }

    public function defaultColumns()
    {
        return [
            'banner_update_time',
            'banner_addtime'
        ];
    }
}